#include<iostream>
using namespace std;
const int N = 110;
int a[N][N];
 
int main()
{
	int cnt = 1;
	int x, y;
	for (int i = 1; i <= N; i++)
	{
		if (i % 2 == 1)
		{
			for (x = i, y = 1; x >= 1 && y <= i; x--, y++)
			{
				a[x][y] = cnt++;
			}
		}
		else
		{
			for (x = 1, y = i; x <= i && y >= 1; x++, y--)
			{
				a[x][y] = cnt++;
			}
		}
	}
	cout << a[20][20] << endl;
 
	return 0;
}
